%
set null off
set date ymd
set cent on
dateto =orequest.querystring("dateto")
thecustomer =nvl(orequest.querystring("customerid"),[])
reportbase =orequest.querystring("reportbase")
wheretext=[]
thecustomername=[]
REPTTITLE=[DEBIT SALE SUMMARY]
REPTSECLINE=[]
if isnull(dateto) or empty(ctod(dateto))
dateto=orequest.form("dateto")
endif
pdate2=ctod(dateto)
set date british
categoryname= allt(nvl(orequest.querystring("category"),''))
classname= allt(nvl(orequest.querystring("class"),''))
if isnull(pdate2) or empty(pdate2)
tsql=[select top 1 date from (']+dbclocation+[invoice') order by date desc into cursor tmp]
&tsql
pdate2=date
endif
if not empty(pdate2)
wheretext=wheretext+[and x.date=pdate2 ]
REPTSECLINE=TRANSFORM(PDATE2)
endif
if not empty(thecustomer)
wheretext=wheretext+[and x.customer=thecustomer ]
tsql=[select x.name from (']+dbclocation+[accounts') x where x.accountid=']+thecustomer+[' into cursor tmp]
&tsql
thecustomername=allt(name)
REPTSECLINE=THECUSTOMERNAME+[ (]+THECUSTOMER+[)]+[
]+REPTSECLINE
endif
if not empty(wheretext)
wheretext=[where ]+subst(wheretext,5)
endif
tstr=[
| Item# | Item Name | QTY | ]+iif(hasbonus,[FREE | T.QTY | ],[])+[
|---|---|---|---|---|
| ]+allt(thisname)+[ (]+accountid+[) | ||||
| ]+iif(empty(THISITEM),[NO ITEM ID],ALLT(THISITEM))+[ | ] thislinestr=thislinestr+[]+iif(empty(THISitemname),[NO ITEM NAME],ALLT( THISitemname))+[ | ] thislinestr=thislinestr+[]+iif(empty(thisqty),[ ],transform(thisqty))+[ | ] if hasbonus thislinestr=thislinestr+[]+iif(empty(thisbonus),[ ],transform(thisbonus))+[ | ] thislinestr=thislinestr+[]+iif(empty(thistotal),[ ],transform(thistotal))+[ | ] endif thislinestr=thislinestr+[